<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Manage_document extends CI_Controller {

    public $session_data;

    public function __construct()
    {
        parent::__construct();
        //Not Completed
        //$this->load->model('info_model');
        $this->load->model('manage_document_model');
        $this->load->helper("url");
        $this->load->library("pagination");

        $this->session_data = $this->session->userdata('logged_in');
    }

    public function view()
    {

        if (!$this->session->userdata('logged_in'))
            redirect('welcome/home','refresh');

        $this->check_user();

        $data['owner_id'] = $this->session_data['user_id'];

        $this->load->helper('form');
        $this->load->library("pagination");
        $data['title'] = "Announcement";

        $session_data = $this->session->userdata('logged_in');

        //echo var_dump($data['annc']);
        //echo var_dump($session_data);

        $data['typeh'] = $session_data['type_no'];

        $this->load->view('template/header', $data);
        $this->load->view('pages/manage_document',$data);
        $this->load->view('template/footer');

    }

    public function check_user(){

        $session_data = $this->session->userdata('logged_in');
        $type = $session_data['type_no'];
        $user_id = $session_data['user_id'];

        $result = $this->manage_document_model->check_user($user_id);

        if( ($type == 0) )
            redirect('information/view_user/'.$user_id, 'refresh');

        //echo var_dump($session_data);
        //echo var_dump($result);
        //echo var_dump($result['coll_id'] == $session_data['coll_id']);

    }

    public function logout()
    {

        $this->session->unset_userdata('logged_in');
        redirect('welcome/home', 'refresh');

    }

}

/* End of file manage_account.php */
/* Location: ./application/controllers/manage_account.php */